package jenum.com;

/**
 * Created by as on 2016/11/17.
 */
enum BookType1 {
    Business, Literature, Computer, Other;

    public String toString()
    {
        if (this.equals(Business))
        {
            return "商业类";
        }else if (this.equals(Literature)) {
            return "文学类";
        }else if(this.equals(Computer)){
            return "计算机";
        }else{
            return "其他";
        }
    }
}

class Enums_toString{
    public static void main(String[] args)
    {
        System.out.println(BookType1.Business);
    }
}

class Enums1_toString{
    public static void main(String[] args)
    {
        BookType type = BookType.Business;
        switch (type)
        {
            case Business:
                System.out.println("商业");
                break;
            case Literature:
                System.out.println("文学");
                break;
            case Computer:
                System.out.println("计算机");
                break;
            case Other:
                System.out.println("其他类");
                break;
        }
    }
}